import requests

# 定义目标URL
url = "https://api.example.com/data"

# 使用get()方法发起GET请求
response = requests.get(url)

# 检查请求状态码
if response.status_code == 200:
    # 如果响应成功，可以访问返回的数据
    data = response.json()
    print("Data received:", data)
else:
    print(f"Request failed with status code {response.status_code}")